<html>
<head><meta charset="utf-8"><title>What core::arch users need from std::simd · project-portable-simd · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/index.html">project-portable-simd</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html">What core::arch users need from std::simd</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212366309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366309">(Oct 05 2020 at 22:54)</a>:</h4>
<p>So I'm using "core::arch users" to imply "intrinsic users, generally" but also just in general we do have a lot of people who are maintaining multiversioned code right now that they would like to write against std::simd instead because they don't actually care <strong>that</strong> much about what it compiles to enough to pick a specific intrinsic.</p>



<a name="212366367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366367">(Oct 05 2020 at 22:55)</a>:</h4>
<p>I think if something doesn't compile to a particular instruction that exists, it should be considered a bug</p>



<a name="212366374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366374">(Oct 05 2020 at 22:55)</a>:</h4>
<p>Maybe instruction is too specific</p>



<a name="212366505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366505">(Oct 05 2020 at 22:57)</a>:</h4>
<p><span class="user-mention" data-user-id="209168">@Thom Chiovoloni</span> mentioned a desire to be able to find "what intrinsic maps to what <code>std::simd</code> operation?" and I mentioned that specific 1:1 mappings are probably not going to be found because that locks the API to mapping to specific intrinsics which we probably don't want, but I don't see anything stopping us from providing elaborations on <em>general patterns</em> that do exist.</p>
<p><span class="user-mention" data-user-id="312331">@Caleb Zulawski</span> I generally agree but we might have good reasons to not (for instance, we are not going to compile to MMX code any time soon) so we are not going to firm that policy up universally.</p>



<a name="212366588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366588">(Oct 05 2020 at 22:58)</a>:</h4>
<p>Maybe I should say it should compile to the same as if you used std::arch</p>



<a name="212366626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366626">(Oct 05 2020 at 22:59)</a>:</h4>
<p>The trade-off should only be the reduction of api surface area, I think</p>



<a name="212366666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366666">(Oct 05 2020 at 22:59)</a>:</h4>
<p>Still only a maybe! It's possible for a given op to have two different instructions for it on a given machine.</p>



<a name="212366748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366748">(Oct 05 2020 at 23:00)</a>:</h4>
<p>we get to pick one.</p>



<a name="212366791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366791">(Oct 05 2020 at 23:00)</a>:</h4>
<p>yeah, my concern is solely around learnability of a new vector API, and documentation.</p>
<p>even when i write simd now, i generally don't care which specific instruction actually gets used. nor really can i: IME you don't always get the one you specify anyway — i can use a _mm_shuffle_ps now and on opt-level 3 llvm might use movhlps (which is the right call when viable)</p>



<a name="212366803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366803">(Oct 05 2020 at 23:01)</a>:</h4>
<p>Yeah, it's hard to clarify as a strict policy.  I agree the particular op doesn't generally matter as long as the performance is roughly the same</p>



<a name="212366834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366834">(Oct 05 2020 at 23:01)</a>:</h4>
<p>If the compiler produces something clearly suboptimal we shouldn't shrug it off as a limitation of the API</p>



<a name="212366842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366842">(Oct 05 2020 at 23:01)</a>:</h4>
<p>(though I don't think anyone was going to do that)</p>



<a name="212366900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366900">(Oct 05 2020 at 23:02)</a>:</h4>
<p><strong>that</strong> I can agree with, modulo a discussion about "clearly".</p>



<a name="212366972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212366972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212366972">(Oct 05 2020 at 23:03)</a>:</h4>
<p>If someone tries to do a fused mul-add on a well-known ISA that implements that and we don't actually generate the faster instructions we better have a good reason.</p>



<a name="212367154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367154">(Oct 05 2020 at 23:04)</a>:</h4>
<p>fma is tricky since it changes the result :(</p>



<a name="212367180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367180">(Oct 05 2020 at 23:04)</a>:</h4>
<p>"Lucy, you've got some 'splaining to do."</p>



<a name="212367194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367194">(Oct 05 2020 at 23:04)</a>:</h4>
<p>yeah but <code>mul_add</code> is a function.</p>



<a name="212367254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367254">(Oct 05 2020 at 23:05)</a>:</h4>
<p>ah, yeah, i see.</p>



<a name="212367371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367371">(Oct 05 2020 at 23:07)</a>:</h4>
<p>So I guess the other question is, what do core::arch users need documentation-wise? <span aria-label="eyes" class="emoji emoji-1f440" role="img" title="eyes">:eyes:</span></p>



<a name="212367397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367397">(Oct 05 2020 at 23:07)</a>:</h4>
<p>the exact thing we can't give them (an assurance about what old functions they were using that they can switch to in our portable API)</p>



<a name="212367409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367409">(Oct 05 2020 at 23:07)</a>:</h4>
<p>lol</p>



<a name="212367454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367454">(Oct 05 2020 at 23:08)</a>:</h4>
<p>I think if we're purposefully not specifying the instruction generated we can't link to vendor instructions</p>



<a name="212367468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367468">(Oct 05 2020 at 23:08)</a>:</h4>
<p>Is there anything else we can give instead tho'?</p>



<a name="212367492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367492">(Oct 05 2020 at 23:08)</a>:</h4>
<p>As Thom mentioned, LLVM won't necessarily even use an instruction you write in some cases!!! Though maybe not everyone is aware of that detail.</p>



<a name="212367507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367507">(Oct 05 2020 at 23:09)</a>:</h4>
<p>( indeed I recall people complain about that about LLVM. )</p>



<a name="212367521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367521">(Oct 05 2020 at 23:09)</a>:</h4>
<p>I think the main thing we can do is make an easy to use API with quality docs, and that'll already be so much better than <code>core::arch</code> that we'll attract people that way.</p>



<a name="212367536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367536">(Oct 05 2020 at 23:09)</a>:</h4>
<p>like, <code>core::arch</code> is a <em>seriously bad time</em> to be using.</p>



<a name="212367602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367602">(Oct 05 2020 at 23:10)</a>:</h4>
<p>RIP.</p>



<a name="212367871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212367871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212367871">(Oct 05 2020 at 23:14)</a>:</h4>
<p>i think it would be easy to do better than vendor docs, so idk if we need to link to them if we commit to doing a good job. my concern is that (i suspect) at least initially, many/most of the users of this API will be people porting existing core::arch intrinsic code to the new api, and i just want to make sure those users (which selfishly include myself) are able to find the new names for things.</p>



<a name="212373997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212373997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212373997">(Oct 06 2020 at 00:51)</a>:</h4>
<p>I think using sensible high-level nomenclature will help here. We'll likely use some hybrid of Rust and the various vendor ways of expressing things.</p>



<a name="212374033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212374033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212374033">(Oct 06 2020 at 00:51)</a>:</h4>
<p>I want to provide a ~1 page glossary, more like "quick refresh on what terms we're using" so that experienced users can read that, find their footing, and be off.</p>



<a name="212389009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212389009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212389009">(Oct 06 2020 at 06:26)</a>:</h4>
<p>The two biggest things I'd ask for, personally:</p>
<ul>
<li>The ability to interoperate at zero cost, so that it's possible to move part of a program to portable SIMD without moving everything at once or having performance issues.</li>
<li>A general strategy of "we provide anything that's fast on at least one platform, even if we have to implement it without hardware support on another platform (but we'll document that)", rather than "we'll only provide things that are fast on many platforms".</li>
</ul>



<a name="212389018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212389018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212389018">(Oct 06 2020 at 06:27)</a>:</h4>
<p>The latter is critical for being able to switch code from native to portable without losing performance in the process.</p>



<a name="212389024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212389024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212389024">(Oct 06 2020 at 06:27)</a>:</h4>
<p>(WASM takes the "only what works everywhere" approach, and that's painful.)</p>



<a name="212389242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212389242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212389242">(Oct 06 2020 at 06:31)</a>:</h4>
<p>(Also, that doesn't mean everything has to exist on day one. But the architecture shouldn't be designed around assumptions like "128-bit is good enough" or "nothing needs to cross 128-bit lanes", for instance.)</p>



<a name="212389260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212389260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212389260">(Oct 06 2020 at 06:31)</a>:</h4>
<p>&lt;BillGates&gt;128 bits is enough for anyone.&lt;/BillGates&gt;</p>



<a name="212391124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212391124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212391124">(Oct 06 2020 at 07:04)</a>:</h4>
<p>don't need a 4th gimble don't need a 129th bit</p>



<a name="212391862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212391862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212391862">(Oct 06 2020 at 07:15)</a>:</h4>
<p>So I generally agree but I do notice one concern (apologies if this is like, sub-intention nitpicking) which is that "one platform" is pretty nebulous here. "x86_64" is a pretty broad platform covering both AMD and Intel CPUs which have pretty different performance characteristics (AMD loves multithreading and focuses on getting high throughput, Intel is... well, Intel), even moreso when vectors are concerned since AMD just straight-up doesn't implement AVX512.</p>



<a name="212392346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212392346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212392346">(Oct 06 2020 at 07:20)</a>:</h4>
<ul>
<li>As far as interaction with <code>std::arch</code> goes, a <code>transmute</code> should be free at runtime with optimization applied.</li>
<li>For platform coverage, we should offer all we can with maximum ergonomics.</li>
<li>Giving specific guidance about what's fast and slow sounds like a whole secondary project on top of the crate, and one that is more of a long term docs issue. possibly best served by ultra-experts in each platform. Like, the Agner Fog tables are a seriously deep investigation that I would hesitate to take on.</li>
</ul>



<a name="212392903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212392903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212392903">(Oct 06 2020 at 07:27)</a>:</h4>
<p>and yeah, a core focus is in fact going to be on allowing essentially-free conversion to <code>arch</code> types because a few people have really wanted a very specific instruction compiled in and my response continues to be "isn't that what <code>std::arch</code> is for???" Here, since we have verrrry deep portability concerns blocking overly-specific compilation promises (the goal is "good" not "a very specific assembly output"), the reality is probably going to be that if someone knows the assembly code they should write the assembly code, or, well, use the <code>std::arch</code> intrinsic more like.</p>



<a name="212393035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212393035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212393035">(Oct 06 2020 at 07:28)</a>:</h4>
<p>Ideally if someone uses <del><code>-march=native</code></del> <code>-C target-cpu=native</code> then it does compile how they expect, but anything <em>less</em> specific than that opens up more ambiguity.</p>



<a name="212394670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212394670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212394670">(Oct 06 2020 at 07:50)</a>:</h4>
<p><code>cargo install</code> should just have a cli flag to use use -Ctarget-cpu=native during the install build</p>



<a name="212394689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212394689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212394689">(Oct 06 2020 at 07:50)</a>:</h4>
<p>or even do it by default</p>



<a name="212397698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212397698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212397698">(Oct 06 2020 at 08:25)</a>:</h4>
<p>isn't target-cpu=native sometimes unsound</p>



<a name="212416250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212416250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ashley Mannix <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212416250">(Oct 06 2020 at 11:56)</a>:</h4>
<p><span class="user-mention" data-user-id="209168">@Thom Chiovoloni</span> Do you mean if you then try run that binary on a different CPU?</p>



<a name="212416487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212416487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212416487">(Oct 06 2020 at 11:59)</a>:</h4>
<p>i meant <a href="https://github.com/rust-lang/rust/issues/64609">https://github.com/rust-lang/rust/issues/64609</a>.</p>



<a name="212416836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212416836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212416836">(Oct 06 2020 at 12:02)</a>:</h4>
<blockquote>
<p>A general strategy of "we provide anything that's fast on at least one platform, even if we have to implement it without hardware support on another platform (but we'll document that)", rather than "we'll only provide things that are fast on many platforms".</p>
</blockquote>
<p>I agree strongly with this, and more or less assumed it would be the case, which is why something like</p>
<blockquote>
<p>~1 page glossary, more like "quick refresh on what terms we're using" so that experienced users can read that, find their footing, and be off.</p>
</blockquote>
<p>sounds insufficient — it would need to be a pretty long glossary. These are big API surfaces. Note that I think you need this <em>more</em> than for the obscure parts of the APIs than the widely used parts.</p>



<a name="212417334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212417334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212417334">(Oct 06 2020 at 12:07)</a>:</h4>
<blockquote>
<p>a core focus is in fact going to be on allowing essentially-free conversion to arch types</p>
</blockquote>
<p>Yes, it would be very annoying if this were not possible. That said, I had assumed transmute to the equivalent arch type would be guaranteed-sound (and possibly safe depending on the status of safe transmute). I think it would be good if the ergonomics were better than "use transmute" but I'm not sure how much worth it's worrying about.</p>



<a name="212455025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212455025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212455025">(Oct 06 2020 at 16:50)</a>:</h4>
<p>i think it's sound to add features just not take them away, at least that's my understanding from reading the issues</p>



<a name="212479238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212479238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212479238">(Oct 06 2020 at 20:13)</a>:</h4>
<p><span class="user-mention" data-user-id="209168">@Thom Chiovoloni</span> For the glossary, my goal would be of getting people oriented on a very meta-level sense so that they knew what they were doing when they explored the API (and so could make short work of that), rather than exploring the API and not being sure of what is going on.</p>



<a name="212481156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212481156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212481156">(Oct 06 2020 at 20:27)</a>:</h4>
<p>i'm not opposed to a glossary at all (quite the opposite), i just don't think that replaces some method of being able to look up a weird intrinsic and find out what it maps to</p>
<p>(but perhaps i misunderstood and we're mostly in agreement)</p>



<a name="212482151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212482151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212482151">(Oct 06 2020 at 20:35)</a>:</h4>
<p>There's certainly an extent to which a person might need to unlearn an intrinsic.</p>



<a name="212485311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212485311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212485311">(Oct 06 2020 at 21:02)</a>:</h4>
<p>I was not necessarily responding directly to that desire.</p>



<a name="212493375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212493375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212493375">(Oct 06 2020 at 22:21)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281757">Jubilee</span> <a href="#narrow/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd/near/212391862">said</a>:</p>
<blockquote>
<p>So I generally agree but I do notice one concern (apologies if this is like, sub-intention nitpicking) which is that "one platform" is pretty nebulous here. "x86_64" is a pretty broad platform covering both AMD and Intel CPUs</p>
</blockquote>
<p>When I said "one platform", I broadly meant "one vector instruction set". As in, if something is fast in one vector instruction set, it's worth exposing, even if other instruction sets have to write it out as a series of instructions. That <em>doesn't</em> necessarily mean matching instructions one-for-one, of course.</p>



<a name="212493519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212493519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212493519">(Oct 06 2020 at 22:22)</a>:</h4>
<p>My hope, generally, is that if someone has an algorithm they wrote using native intrinsics, they can almost always translate that algorithm to portable SIMD and end up with close to the same instructions generated on that target, as well as running elsewhere with varying degrees of performance.</p>



<a name="212493658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212493658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212493658">(Oct 06 2020 at 22:24)</a>:</h4>
<p>yeah that seems like the ideal. it's a lot of operations... but it also simplifies the decision process about what to support. i don't envy whoever implements the sse4.2 fallback though!</p>



<a name="212494319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212494319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212494319">(Oct 06 2020 at 22:32)</a>:</h4>
<p>Once the infrastructure for it is in place, perhaps someone would like to record a video of live-coding a few portable intrinsics, starting from instruction-set documentation and native intrinsics. That plus a call for help via @rustlang could produce some contributions.</p>



<a name="212494430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212494430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212494430">(Oct 06 2020 at 22:34)</a>:</h4>
<p>OK then~ Yeah, I basically think that's relatively ideal.</p>



<a name="212495422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212495422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212495422">(Oct 06 2020 at 22:46)</a>:</h4>
<p>I don't think we will in practice be able to support every single niche on every single instruction set because we're going to run into odd cases that don't port well anywhere else... but that's "the breaks" and not something magically inherent, not something I intend to accept without a fight. I would like to be able to have as expansive an API as possible, preferably by providing abstractions that are inclined to port well over different SIMD ISAs.</p>
<p>And if something is supported on any 2 target architectures, I think it's basically a given that we are going to make an effort to include it. At the WASM SIMD level of "it's basically everywhere", it definitely will warp our API design more? But I don't think it has to be "everywhere" for us to really want to include it, it just has to be in <em>enough</em> places and not completely degenerate in performance elsewhere.</p>



<a name="212495576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212495576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212495576">(Oct 06 2020 at 22:48)</a>:</h4>
<p>I think a good criteria would be "if we implement this without any hardware support, is the result going to be <em>worse</em> than what someone could write themselves".</p>



<a name="212495614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212495614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212495614">(Oct 06 2020 at 22:49)</a>:</h4>
<p><em>Yes.</em> That is a very good baseline to catch ourselves on.</p>



<a name="212495628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212495628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212495628">(Oct 06 2020 at 22:49)</a>:</h4>
<p>If a platform doesn't have any kind of hardware support for an operation, that operation is going to be slower. But it should still be <em>possible</em>, and it shouldn't be <em>substantially</em> slower than if it was hand-written for that platform.</p>



<a name="212495659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212495659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212495659">(Oct 06 2020 at 22:50)</a>:</h4>
<p>Now, it's always possible that someone might write a SIMD algorithm expecting certain operations to be fast, and the combination of those operations implements something that would have been faster if done another way.</p>



<a name="212495720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212495720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212495720">(Oct 06 2020 at 22:50)</a>:</h4>
<p>But that suggests that we could implement a higher-level operation that decomposes differently on different targets.</p>



<a name="212495755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212495755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212495755">(Oct 06 2020 at 22:51)</a>:</h4>
<p>(Within reason. I don't expect to have a branch-and-do-zlib intrinsic in portable SIMD; flate2 and zlib-ng can worry about that. ;) )</p>



<a name="212495769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212495769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212495769">(Oct 06 2020 at 22:51)</a>:</h4>
<p>(s390 does actually have hardware instructions for DEFLATE, so I'm not actually joking there.)</p>



<a name="212495994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212495994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212495994">(Oct 06 2020 at 22:54)</a>:</h4>
<p>amazing.</p>



<a name="212496017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212496017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212496017">(Oct 06 2020 at 22:54)</a>:</h4>
<p>I mean, you often have to jump through hoops and do redundant work and such to make a algorithm work for simd, so i think the answer is very very often going to be "yes if you wrote it by hand you'll get better results than if you use it on targets with no hardware support". </p>
<p>i mean i agree about cases like DEFLATE, but i could imagine someone using the AESNI stuff as a similar example, and I suspect we want to support those.</p>
<p>i guess a good example would be sse4.2, which is probably going to be several orders of magnitude slower without hw support (unless i'm missing a clever way to implement it)</p>



<a name="212497559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212497559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212497559">(Oct 06 2020 at 23:16)</a>:</h4>
<p>I think... maybe there's a mild disconnect here.</p>
<blockquote>
<p>perhaps someone would like to record a video of live-coding a few portable intrinsics, starting from instruction-set documentation and native intrinsics.</p>
</blockquote>
<p>This is the exact opposite of the approach being taken so far. We're <em>not</em> looking at specific intrinsics in specific arches and then saying "how do we make this portable?". That's a fairly losing battle because it would take forever. Instead we're mostly letting you speak clearly to LLVM about what you want and letting LLVM handle it.</p>
<p><strong>Example:</strong> Addition.</p>
<ul>
<li>The starting point <em>is not</em>  "okay here's <code>_mm_add_ps</code>, how do we make it portable?".</li>
<li>The starting point is that you want addition on floats.</li>
</ul>
<p>LLVM knows how to do that, so we just say "do the addition", and then at the library level we're done, and LLVM handles it. How <em>specifically</em> that codegens in the end can depend on optimization level and cpu features selected and all that jazz, so we're actively <em>avoiding</em> saying that you get a specific anything. The semantics are just "the floats in each lane are added and you get a set of lanes of the outputs". Trying to list out "Oh this is <code>_mm_add_ps</code> or maybe <code>vaddq_f32</code> or maybe etc etc" would actually <em>complicate</em> learning the API. The best way to use a <strong>portable</strong> API is to step back from thinking about specific intrinsics and instructions you want, and just communicate the <em>semantics</em> you want to the compiler, and then it will figure out the rest from there.</p>
<p>The main job we have in front of us is to ensure that we can offer consistent semantics across platforms.</p>



<a name="212498309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212498309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212498309">(Oct 06 2020 at 23:27)</a>:</h4>
<blockquote>
<p>Instead we're mostly letting you speak clearly to LLVM about what you want and letting LLVM handle it.</p>
</blockquote>
<p>I suspect this approach has a bit more mileage but will stop working relatively soon. I had assumed we'd eventually implement intrinsic-equivalent functionality — The downsides of only doing what LLVM can support are:</p>
<ul>
<li>adding new functionality is much harder as it requires getting code for it into LLVM.</li>
<li>many existing libraries will end up unable to port to the new API.</li>
<li>code that does port, or is written whole-cloth using the new API, will have to dip into platform intrinsics for less common operations, or implement the shim themselves.</li>
</ul>
<p>among others.</p>
<blockquote>
<p>The best way to use a portable API is to step back from thinking about specific intrinsics and instructions you want, and just communicate the semantics you want to the compiler, and then it will figure out the rest from there.</p>
</blockquote>
<p>I agree, but I don't think it follows that this is the best way to write an API like this.</p>



<a name="212499600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212499600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212499600">(Oct 06 2020 at 23:44)</a>:</h4>
<p>I don't mean to say that "LLVM has sin and cos, but not tan, so we refuse to implement tan because it's not in LLVM". I don't mean to say that what can be done by direct LLVM intrinsic is the only thing to do.</p>
<p>But I do mean that the outside API should be, for example <code>f32xN::ceil</code>, and if that happens to be done via hardware or not, you should step back from trying to worry about specific intrinsics</p>



<a name="212501034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212501034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212501034">(Oct 07 2020 at 00:02)</a>:</h4>
<p>Oh, I don't think anybody was suggesting <em>exposing</em> an intrinsic-alike API. My point was more: a lot of code will end up using one or two weirder instructions that LLVM doesnt offer a portable equivalent. Say: <code>_mm_movemask_ps</code>¹ (this is not weird as in rarely used at all, it's just semantically a bit odd).</p>
<p>It's often pretty easy (trivial for movemask) to implement a portable equivalent to this, so we should support it even though it's not like LLVM will automatically implement the portable versions for us.</p>
<p>I also <em>don't</em> think we should name it the same as the intel intrinsic² as intel intrinsic names range are all either "bad" or "consonant soup".</p>
<p>Now, I do think at the end of the day this will mean some of the result APIs will kinda be... a bit intrinsic shaped. E.g. a lot of it you might not include if it weren't for the fact that there's dedicated hardware support for it.</p>
<p>That's all to say, I think some parts of this will look more like <code>safe_arch</code> than <code>core::num</code>, but hopefully some thoughtful design can bridge the gap there well enough.</p>
<hr>
<p>¹: This is perhaps not the best example, as I suspect it's existence informed the design of the mask vectors, but it works well enough.</p>
<p>²:  That said, as I've made pretty clear, IMO whatever we <em>do</em> name it should be discoverable if you search for the intrinsic in the docs, even if it's not directly mentioned in the docs (or for weird ones, only mentioned in a handwavey "this is mirrors functionality provided by the &lt;intrinsic&gt; intrinsic from &lt;vendor&gt;").</p>



<a name="212501075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212501075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212501075">(Oct 07 2020 at 00:03)</a>:</h4>
<p>Correct.<br>
I am basically never going to be thinking about specific assembly or even specific instructions, I am going to be thinking at e.g. the level of NE10 API (one of many SIMD-optimized libraries, this one is specifically for ARM) and I am going to be thinking at the level of the overall <em>patterns</em> that are provided by intrinsics.</p>



<a name="212501401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212501401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212501401">(Oct 07 2020 at 00:07)</a>:</h4>
<p>realistically my brain has been destroyed by intel mindpoison so i'll probably think in SSE until I die.... but my hope with participating here is to help this to be at a point where i can move past __m128 and think in core::simd</p>



<a name="212501487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212501487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212501487">(Oct 07 2020 at 00:08)</a>:</h4>
<p>Masks are basically necessary to write something like <code>f32x4.filter().for_each()</code>, and like, if I could provide things as high-level as the Iterator API I would be happy to.</p>



<a name="212501577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212501577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212501577">(Oct 07 2020 at 00:09)</a>:</h4>
<p>i kinda think that something like high level simd iterator should be provided by a 3rd party crate, or at least requires a lot of design work first.</p>
<p>(actually maybe thats what you mean)</p>



<a name="212501811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/What%20core%3A%3Aarch%20users%20need%20from%20std%3A%3Asimd/near/212501811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/What.20core.3A.3Aarch.20users.20need.20from.20std.3A.3Asimd.html#212501811">(Oct 07 2020 at 00:12)</a>:</h4>
<p>Ah, "as high level as", not literally the Iterator API. <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span><br>
But it would require a lot of design work first, yes!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>